<?php
class db
{
	private $dbfile = "../data/mrb.db";
	public $dbc;
	
	function connect() {
		if(file_exists($this->dbfile)) {
			$this->dbc = new PDO('sqlite:'.$this->dbfile);
			if(!$this->dbc) echo("Connect database failed!");
		}
	}
	
	function query($sql) {
		$q = $this->dbc->prepare($sql);
		$q->execute();
		$res = array();
		$res = $q->fetchAll();
		return $res;
	}
	
	function execute($sql) {
		$e = $this->dbc->exec($sql);
		return $e;
	}
}
?>